> THIS IS A MESSAGE IN 'MIME' FORMAT. Your mail reader does not support MIME. > You may not be able to read some parts of this message. --PART.BOUNDARY.0054.789363485 Content-ID: <54_61_1_789363212> Content-Type: text/plain Content-Transfer-Encoding: 7Bit Content-Description: Chin Huang, Attached is the diff file for some changes that I think need to be made to news.c. News.c compiles fine with these changes, but I have not recompiled souper, since I don't have the socket libraries yet. Robert Blenis e-mail:blenis@spanky.marc.gatech.edu Os/2 Warp 3 ... engage. --PART.BOUNDARY.0054.789363485 Content-ID: <54_61_1_789363387> Content-Type: text/plain Content-Transfer-Encoding: 7Bit Content-Description: --- news.old.c Thu Jan 05 08:20:00 1995 +++ news.c Thu Jan 05 22:42:08 1995 @@ -5,6 +5,7 @@ #include #include #include +#include #include "socket.h" #include "nntp.h" #include "nntpcl.h" @@ -303,6 +304,10 @@ /* If the list is empty, make one new entry marking everything up to the lowest available article as read */ if (head == NULL) { + if (lo == 1) /* if lowest avail. article is 1, then leave read list empty */ + /* otherwise when a new group was started, the first */ + /* article would be skipped */ + return NULL; rp1 = (Range *)xmalloc(sizeof(Range)); rp1->lo = 1; rp1->hi = (lo > 1) ? (lo-1) : 1; @@ -326,6 +331,11 @@ free(rp2); rp2 = rp3; } + if (lo == 1) { /* if lowest avail. article is 1, then leave read list empty */ + /* otherwise when group is reset, the first article would be skipped */ + free(head); + return NULL; + } head->next = NULL; return head; } @@ -333,28 +343,35 @@ /* Now walk through the list and eliminate ranges lower than the lowest available article */ rp1 = head; - while (rp1 != NULL) { - /* If lowest read article of this range is smaller - than the lowest available article, all the rest - of the ranges are unnecessary */ - if (rp1->lo < lo) { - /* Make this range from 1 to lo */ - rp1->lo = 1; - if (rp1->hi < lo) rp1->hi = lo - 1; - - /* Free the rest */ - rp2 = head; - while (rp2 != rp1) { - rp3 = rp2->next; - free(rp2); - rp2 = rp3; - } - return rp1; + while (rp1->next != NULL) { + if( rp1->next->lo > lo ) + break; + rp1=rp1->next; + } + if ((rp1->lo > lo) && (lo > 1)) { + /* rp1=1st in list and lowest avail. is < lowest read, so insert */ + /* record marking 1..lo-1 (as long as lo != 1) as read. */ + rp2 = (Range *)xmalloc(sizeof(Range)); + rp2->lo = 1; + rp2->hi = lo-1; + rp2->next = rp1; + return rp2; + } + if (rp1->lo <= lo) { + rp1->lo = 1; + rp2 = head; /* eliminate previous records */ + while (rp2 != rp1) { + rp3 = rp2->next; + free(rp2); + rp2=rp3; + } + head = rp1; + + if( rp1->hi < lo) + rp1->hi = lo-1; } - rp1 = rp1->next; - } - return head; /* Probably shouldn't get here */ + return head; } /* Process an Xref line. */ @@ -467,7 +484,7 @@ byteCount += artSize + 14; /* Write "rnews" line */ - fprintf(msgf, "#! rnews %d\n", artSize); + fprintf(msgf, "#! rnews %ld\n", artSize); /* Copy article body. */ fseek(tmpF, 0L, SEEK_SET); --PART.BOUNDARY.0054.789363485--